import React, { useState } from 'react';
import { history } from 'umi';

export default function IndexPage() {
  const [account, setAccount] = useState<string>();
  const [password, setPassword] = useState<string>();

  function jumppppp() {
    if (account === '' && account === '') {
      sessionStorage.setItem('login', '1');
      history.push('/account');
    }
  }

  return (
    <React.Fragment>
      <div
        style={{
          display: 'flex',
          alignItems: 'center',
          justifyContent: 'center',
          flexDirection: 'column',
          width: '100%',
          height: '100vh',
        }}
      >
        <input
          style={{ margin: '20px' }}
          type="text"
          placeholder="账号"
          value={account}
          onChange={(value) => {
            setAccount(value.target.value);
          }}
        />
        <input
          style={{ margin: '20px' }}
          type="text"
          placeholder="密码"
          value={password}
          onChange={(value) => {
            setPassword(value.target.value);
          }}
        />
        <button style={{ margin: '20px' }} onClick={() => jumppppp()}>
          登录
        </button>
      </div>
    </React.Fragment>
  );
}
